package com.dure.hotmemory;

import android.app.Application;

import com.dure.hotmemory.bean.DaoMaster;
import com.dure.hotmemory.bean.DaoSession;
import com.fuqianla.paysdk.FuQianLa;
import com.socks.library.KLog;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

import org.greenrobot.greendao.database.Database;
import org.xutils.x;

/**
 * Created by leix on 12/06/2017.
 */

public class MyApplication  extends Application{
    public static final boolean ENCRYPTED = false;

    private DaoSession daoSession;

    @Override
    public void onCreate() {
        super.onCreate();
        KLog.init(BuildConfig.DEBUG);
        x.Ext.init(this);
        x.Ext.setDebug(BuildConfig.DEBUG);

        UMConfigure.init(this,"593f7ae75312dd86d9000ee9"
                ,"hotmemory",UMConfigure.DEVICE_TYPE_PHONE,"");
        UMConfigure.setLogEnabled(BuildConfig.DEBUG);

        FuQianLa.getInstance().init(getApplicationContext());

        PlatformConfig.setQQZone("1106223114", "QjTkWqRXqNAVkJfD");
        PlatformConfig.setWeixin("wx4e5a24043362deb8", "b3cf5c759b6c8c04fd297205dd86dc15");
        PlatformConfig.setSinaWeibo("1541166078", "3af5e70e847bdd1753b63a1c61a61f08","http://sns.whalecloud.com");

        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, ENCRYPTED ? "notes-db-encrypted" : "notes-db");
        Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb();
        daoSession = new DaoMaster(db).newSession();
    }

    public DaoSession getDaoSession() {
        return daoSession;
    }
}
